package com.lyc.servlet.admin;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.lyc.dao.MedalInfoDAO;
import com.lyc.dao.imp.MedalInfoDAOImpl;
import com.lyc.entity.MedalInfo;

@WebServlet("/admin/medal-list.let")
public class MedalInfoListServlet extends HttpServlet {
	private MedalInfoDAO dao = new MedalInfoDAOImpl();
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.reset();
		response.setContentType("application/json;charset=utf-8");
		
		try {
			List<MedalInfo> list = dao.select(0, 999);
			response.getWriter().print(JSON.toJSONString(dao.selectMap(0, 999)));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		response.flushBuffer();
	}

}
